package com.wdemo.controller;

import com.wdemo.service.ChatService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @ClassName ChatController
 * @Description 对话机器人
 * @Author WDEMO
 * @Date 2025/8/20 16:39
 */
@RestController
@RequestMapping("/ai")
@CrossOrigin
@RequiredArgsConstructor
public class ChatController {

    private final ChatService chatService;

    /**
     * 流式返回
     * @param prompt
     * @return
     */
    @RequestMapping(value = "/chat",produces = "text/html;charset=utf-8")
    public Flux<String> chatStream(String prompt,String chatId){
        return chatService.chatStream(prompt,chatId);
    }


    /**
     * 哄哄模拟器接口
     * @param prompt
     * @param chatId
     * @return
     */
    @RequestMapping(value = "/game",produces = "text/html;charset=utf-8")
    public Flux<String> game(String prompt,String chatId){
      return chatService.game(prompt,chatId);
    }


    /**
     * 客服
     * @param prompt
     * @param chatId
     * @return
     */
    @GetMapping("/service")
    public Flux<String> service(String prompt,String chatId){
        return chatService.service(prompt,chatId);
    }


}
